package com.bw.shop.controller;

import com.bw.common.domain.Brand;
import com.bw.common.domain.Car;
import com.bw.common.domain.Lx;
import com.bw.common.domain.Shop;
import com.bw.common.result.Result;
import com.bw.shop.service.ShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * @Author：HaoYunde
 * @Package：com.bw.shop.controller
 * @Project：hyd-boot
 * @name：ShopController
 * @Date：2024/6/17 10:43
 */
@RestController
@RequestMapping("/list")
public class ShopController {
    @Autowired
    public ShopService service;



    /**
     * 查询品牌表
     * @return
     */
    @GetMapping("findbrand")
    @Scheduled(cron = "0/2 * * * * ?")
    public Result<List<Brand>> findbrand(){
        List<Brand> list=service.findbrand();
        return Result.success(list);
    }


    /**
     * 查询类型表
     * @return
     */
    @GetMapping("findLx")
    public Result<List<Lx>> findLx(){
        List<Lx> list=service.findLx();
        return Result.success(list);
    }



    @PostMapping("/addList")
    public Result addList(@RequestBody Shop shop){
        return service.addList(shop);
    }


    @GetMapping("/findList")
    public Result<List<Shop>> findList(){
        List<Shop> list= service.findList();
        return Result.success(list);
    }


    @PostMapping("/upload")
    public Result upload(@RequestBody MultipartFile file){
        return service.upload(file);
    }


    @PostMapping("/addCarList")
    public Result addCarList(@RequestBody Car car){
        return service.addCarList(car);
    }

}
